package com.gls.framework.web.core.configurer.adapter;

import com.gls.security.core.configurer.adapter.RequestMatcherConfigurerAdapter;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configurers.ExpressionUrlAuthorizationConfigurer;
import org.springframework.stereotype.Component;

/**
 * @author lizhiyong
 */
@Component
public class SwaggerRequestMatcherConfigurerAdapter implements RequestMatcherConfigurerAdapter {
    @Override
    public boolean configure(ExpressionUrlAuthorizationConfigurer<HttpSecurity>.ExpressionInterceptUrlRegistry expressionInterceptUrlRegistry) {
        expressionInterceptUrlRegistry.antMatchers(
                "/**/swagger-ui.html",
                "/**/webjars/**",
                "/**/v2/api-docs",
                "/**/swagger-resources/**"
        ).permitAll();
        return false;
    }
}
